{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/sasse/.local/lib/python3.6/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import networkx as nx\n",
    "import sys, os\n",
    "sys.path.append(os.path.abspath('../GCN'))\n",
    "import gcnIO"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "network_name = 'Multinet'\n",
    "network_path = '../data/pancancer/all_omics_multinet/MULTINET_multiomics.h5'\n",
    "out_path = '/project/gcn/diseasegcn/data/networks/{}_numeric.csv'.format(network_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "DeepWalk input written to /project/gcn/diseasegcn/data/networks/Multinet_numeric.csv\n"
     ]
    }
   ],
   "source": [
    "data = gcnIO.load_hdf_data(network_path)\n",
    "network, features, y_train, y_val, y_test, train_mask, val_mask, test_mask, node_names, feat_names = data\n",
    "\n",
    "G = nx.from_numpy_matrix(network)\n",
    "edgelist_numeric = nx.to_pandas_edgelist(G)\n",
    "edgelist_numeric.set_index('source', inplace=True)\n",
    "edgelist_numeric.to_csv(out_path, header=None, sep=' ')\n",
    "print (\"DeepWalk input written to {}\".format(out_path))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
